import 'package:flutter/material.dart';

class CustomAppBar extends StatelessWidget {
  final textEditingController = TextEditingController();
  @override
  Widget build(BuildContext context) {
    double paddingTop = MediaQuery.of(context).padding.top;
    textEditingController.addListener(() {
      print('input ${textEditingController.text}');
    });
    return Container(
        margin: EdgeInsets.fromLTRB(20, paddingTop, 20, 5),
        padding: EdgeInsets.fromLTRB(20, 7, 20, 7),
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(19),
          color: Colors.white60,
        ),
        child: Row(
          children: [
            Icon(Icons.search, color: Colors.grey),
            Expanded(
                child: Padding(
              padding: const EdgeInsets.only(left: 10, right: 10),
              child: TextField(
                controller: textEditingController,
                cursorColor: Colors.black,
                cursorWidth: 1,
                cursorHeight: 18,
                maxLines: 1,
                style: TextStyle(fontSize: 15, color: Colors.black87), //输入文本的样式
                decoration: InputDecoration.collapsed(
                  hintText: '长安十二时辰',
                  hintStyle: TextStyle(fontSize: 15, color: Colors.grey),
                  // border:OutlineInputBorder(borderRadius: BorderRadius.circular(15.0),borderSide: BorderSide(color:Colors.transparent)),
                ),
              ),
            )),
            Container(
              width: 1,
              height: 20,
              margin: EdgeInsets.only(right: 13),
              decoration: BoxDecoration(color: Colors.grey),
            ),
            Text('书城', style: TextStyle(fontSize: 13))
          ],
        ));
  }
}
